package SecondeStage.IO.In_OutputStreamReader_Writer;

import java.io.*;

public class InputStreamReader_ {
    public static void main(String[] args) throws IOException {
        // 使用InputStreamReader转换中文乱码问题
        // 将字节流FileInputStream 转换为字符流 InputStreamReader,指定编码 gbk/utf-8
        String filePath ="D:\\Java\\JavaProject\\ok.txt";
        // 1.FileInputStream 转换为 InputStreamReader
        // 2.指定编码 gbk
        InputStreamReader isr = new InputStreamReader(new FileInputStream(filePath),"UTF-8");
        // 3.把InputStreamReader 传入 BufferedReader
        BufferedReader br = new BufferedReader(isr);
        // 4.读取
        String s = br.readLine();
        System.out.println("读取内容:"+s);
        // 5.关闭外层流
        br.close();
    }
}
